import type { AxiosResponse } from "axios";
// import { useStore } from '@/stores/user'
import router from '@/router'
import Cookies from "js-cookie";
import {userInforStore} from "@/stores/user"
export const responseInterceptor = (res: AxiosResponse) => {
  // 直接返回res，当然你也可以只返回res.data
  // 系统如果有自定义code也可以在这里处理
  const store = userInforStore()
  if(res.data.code == 1001){
    // ElMessage.error(res.data.message)
    Cookies.remove("access_token")
    store.access_token = ''
    store.menu = []
    router.push('/login')
  }
  return res.data
}


